package com.auxgroup.hr.front.site.co.modPerson;

import javax.annotation.Resource;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.auxgroup.hr.front.commons.BaseRetCode;
import com.auxgroup.hr.front.commons.vo.BaseResponseVO;
import com.auxgroup.hr.front.dao.domain.PsCModEmpPhoto;
import com.auxgroup.hr.front.dozer.IObjectMapper;
import com.auxgroup.hr.front.service.modperson.ModEmpPhotoService;
import com.auxgroup.hr.front.site.co.BaseCO;

/**
 * 人员照片流程信息CO
 * @author lvliuhao
 * @version 创建时间：180526 
 */
@RestController
@RequestMapping("${auxgroup.hr.contextPath}/modEmpPhoto")
public class ModEmpPhotoCO extends BaseCO {

	private static final Logger logger = LoggerFactory.getLogger(ModEmpPhotoCO.class);

	@Autowired
	public ModEmpPhotoService modEmpPhotoService;

	@Resource(name = "dozerMapper")
	protected IObjectMapper objectMapper;

	/**
	 * 保存人员照片流程信息
	 * @param hireId
	 * @return
	 */
	@PostMapping(value = "/save")
	public BaseResponseVO save(PsCModEmpPhoto modEmpPhoto) {
		logger.info("saveModEmpPhoto param= {}", modEmpPhoto);
		if(StringUtils.isBlank(modEmpPhoto.getcTransactionNbr())){
			return buildRespone(BaseRetCode.CODE_ERROR_REQUEST_PARAM_NULL.getRetCode(), "流程编号不能为空");
		}
		if(StringUtils.isBlank(modEmpPhoto.getEmplid())){
			return buildRespone(BaseRetCode.CODE_ERROR_REQUEST_PARAM_NULL.getRetCode(), "员工ID不能为空");
		}
		modEmpPhoto = modEmpPhotoService.save(modEmpPhoto);
		if(modEmpPhoto.getEmplid()!=null){
			return buildRespone(true);
		}
		return buildRespone(false);
	}

}
